; ModuleID = '/Users/aserlili/Documents/Codes/llvm-build/test/OllvmTest/calculate.cpp'
source_filename = "/Users/aserlili/Documents/Codes/llvm-build/test/OllvmTest/calculate.cpp"
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128-Fn32"
target triple = "arm64-apple-macosx15.0.0"

%struct._opaque_pthread_once_t = type { i64, [8 x i8] }

@once_flag = global %struct._opaque_pthread_once_t { i64 816954554, [8 x i8] zeroinitializer }, align 8
@.str = private unnamed_addr constant [22 x i8] c"This runs only once!\0A\00", align 1
@_ZL10once_flag2 = internal global %struct._opaque_pthread_once_t { i64 816954554, [8 x i8] zeroinitializer }, align 8
@.str.1 = private unnamed_addr constant [31 x i8] c"[calculate] a=%lf,b=%lf,op=%c\0A\00", align 1
@_Z9calculateddc_IndirectBrTargets = private global [10 x ptr] [ptr getelementptr (i8, ptr blockaddress(@_Z9calculateddc, %if.then4), i64 -1899277012), ptr getelementptr (i8, ptr blockaddress(@_Z9calculateddc, %if.then), i64 -1899277012), ptr getelementptr (i8, ptr blockaddress(@_Z9calculateddc, %if.then12), i64 -1899277012), ptr getelementptr (i8, ptr blockaddress(@_Z9calculateddc, %if.else9), i64 -1899277012), ptr getelementptr (i8, ptr blockaddress(@_Z9calculateddc, %if.else16), i64 -1899277012), ptr getelementptr (i8, ptr blockaddress(@_Z9calculateddc, %if.then14), i64 -1899277012), ptr getelementptr (i8, ptr blockaddress(@_Z9calculateddc, %if.else15), i64 -1899277012), ptr getelementptr (i8, ptr blockaddress(@_Z9calculateddc, %if.else), i64 -1899277012), ptr getelementptr (i8, ptr blockaddress(@_Z9calculateddc, %if.then8), i64 -1899277012), ptr getelementptr (i8, ptr blockaddress(@_Z9calculateddc, %if.else5), i64 -1899277012)]
@llvm.compiler.used = appending global [1 x ptr] [ptr @_Z9calculateddc_IndirectBrTargets], section "llvm.metadata"

; Function Attrs: mustprogress noinline optnone ssp uwtable(sync)
define void @_Z13init_functionv() #0 {
entry:
  %call = call i32 (ptr, ...) @printf(ptr noundef @.str)
  ret void
}

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: mustprogress noinline optnone ssp uwtable(sync)
define noundef ptr @_Z11thread_funcPv(ptr noundef %arg) #0 {
entry:
  %arg.addr = alloca ptr, align 8
  store ptr %arg, ptr %arg.addr, align 8
  %call = call i32 @pthread_once(ptr noundef @once_flag, ptr noundef @_Z13init_functionv)
  ret ptr null
}

declare i32 @pthread_once(ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress noinline optnone ssp uwtable(sync)
define void @_Z14init_function2v() #0 {
entry:
  %call = call i32 (ptr, ...) @printf(ptr noundef @.str)
  ret void
}

; Function Attrs: mustprogress noinline optnone ssp uwtable(sync)
define noundef ptr @_Z12thread_func2Pv(ptr noundef %arg) #0 {
entry:
  %arg.addr = alloca ptr, align 8
  store ptr %arg, ptr %arg.addr, align 8
  %call = call i32 @pthread_once(ptr noundef @_ZL10once_flag2, ptr noundef @_Z14init_function2v)
  ret ptr null
}

; Function Attrs: mustprogress noinline optnone ssp uwtable(sync)
define noundef double @_Z9calculateddc(double noundef %a, double noundef %b, i8 noundef signext %op) #0 {
entry:
  %retval = alloca double, align 8
  %a.addr = alloca double, align 8
  %b.addr = alloca double, align 8
  %op.addr = alloca i8, align 1
  store double %a, ptr %a.addr, align 8
  store double %b, ptr %b.addr, align 8
  store i8 %op, ptr %op.addr, align 1
  %0 = load double, ptr %a.addr, align 8
  %1 = load double, ptr %b.addr, align 8
  %2 = load i8, ptr %op.addr, align 1
  %conv = sext i8 %2 to i32
  %call = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %0, double noundef %1, i32 noundef %conv)
  %3 = load i8, ptr %op.addr, align 1
  %conv1 = sext i8 %3 to i32
  %cmp = icmp eq i32 %conv1, 43
  %4 = select i1 %cmp, i64 1, i64 7
  %5 = getelementptr [10 x ptr], ptr @_Z9calculateddc_IndirectBrTargets, i64 0, i64 %4
  %EncDestAddr = load ptr, ptr %5, align 8
  %6 = getelementptr i8, ptr %EncDestAddr, i64 1899277012
  indirectbr ptr %6, [label %if.then, label %if.else]

if.then:                                          ; preds = %entry
  %7 = load double, ptr %a.addr, align 8
  %8 = load double, ptr %b.addr, align 8
  %add = fadd double %7, %8
  store double %add, ptr %retval, align 8
  br label %return

if.else:                                          ; preds = %entry
  %9 = load i8, ptr %op.addr, align 1
  %conv2 = sext i8 %9 to i32
  %cmp3 = icmp eq i32 %conv2, 45
  %10 = select i1 %cmp3, i64 0, i64 9
  %11 = getelementptr [10 x ptr], ptr @_Z9calculateddc_IndirectBrTargets, i64 0, i64 %10
  %EncDestAddr17 = load ptr, ptr %11, align 8
  %12 = getelementptr i8, ptr %EncDestAddr17, i64 1899277012
  indirectbr ptr %12, [label %if.then4, label %if.else5]

if.then4:                                         ; preds = %if.else
  %13 = load double, ptr %a.addr, align 8
  %14 = load double, ptr %b.addr, align 8
  %sub = fsub double %13, %14
  store double %sub, ptr %retval, align 8
  br label %return

if.else5:                                         ; preds = %if.else
  %15 = load i8, ptr %op.addr, align 1
  %conv6 = sext i8 %15 to i32
  %cmp7 = icmp eq i32 %conv6, 42
  %16 = select i1 %cmp7, i64 8, i64 3
  %17 = getelementptr [10 x ptr], ptr @_Z9calculateddc_IndirectBrTargets, i64 0, i64 %16
  %EncDestAddr18 = load ptr, ptr %17, align 8
  %18 = getelementptr i8, ptr %EncDestAddr18, i64 1899277012
  indirectbr ptr %18, [label %if.then8, label %if.else9]

if.then8:                                         ; preds = %if.else5
  %19 = load double, ptr %a.addr, align 8
  %20 = load double, ptr %b.addr, align 8
  %mul = fmul double %19, %20
  store double %mul, ptr %retval, align 8
  br label %return

if.else9:                                         ; preds = %if.else5
  %21 = load i8, ptr %op.addr, align 1
  %conv10 = sext i8 %21 to i32
  %cmp11 = icmp eq i32 %conv10, 47
  %22 = select i1 %cmp11, i64 2, i64 4
  %23 = getelementptr [10 x ptr], ptr @_Z9calculateddc_IndirectBrTargets, i64 0, i64 %22
  %EncDestAddr19 = load ptr, ptr %23, align 8
  %24 = getelementptr i8, ptr %EncDestAddr19, i64 1899277012
  indirectbr ptr %24, [label %if.then12, label %if.else16]

if.then12:                                        ; preds = %if.else9
  %25 = load double, ptr %b.addr, align 8
  %cmp13 = fcmp une double %25, 0.000000e+00
  %26 = select i1 %cmp13, i64 5, i64 6
  %27 = getelementptr [10 x ptr], ptr @_Z9calculateddc_IndirectBrTargets, i64 0, i64 %26
  %EncDestAddr20 = load ptr, ptr %27, align 8
  %28 = getelementptr i8, ptr %EncDestAddr20, i64 1899277012
  indirectbr ptr %28, [label %if.then14, label %if.else15]

if.then14:                                        ; preds = %if.then12
  %29 = load double, ptr %a.addr, align 8
  %30 = load double, ptr %b.addr, align 8
  %div = fdiv double %29, %30
  store double %div, ptr %retval, align 8
  br label %return

if.else15:                                        ; preds = %if.then12
  store double -1.000000e+00, ptr %retval, align 8
  br label %return

if.else16:                                        ; preds = %if.else9
  store double -1.000000e+00, ptr %retval, align 8
  br label %return

return:                                           ; preds = %if.else16, %if.else15, %if.then14, %if.then8, %if.then4, %if.then
  %31 = load double, ptr %retval, align 8
  ret double %31
}

attributes #0 = { mustprogress noinline optnone ssp uwtable(sync) "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,+zcm,+zcz" }
attributes #1 = { "frame-pointer"="non-leaf" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="apple-m1" "target-features"="+aes,+altnzcv,+ccdp,+ccidx,+complxnum,+crc,+dit,+dotprod,+flagm,+fp-armv8,+fp16fml,+fptoint,+fullfp16,+jsconv,+lse,+neon,+pauth,+perfmon,+predres,+ras,+rcpc,+rdm,+sb,+sha2,+sha3,+specrestrict,+ssbs,+v8.1a,+v8.2a,+v8.3a,+v8.4a,+v8a,+zcm,+zcz" }

!llvm.module.flags = !{!0, !1, !2, !3, !4}
!llvm.ident = !{!5}

!0 = !{i32 2, !"SDK Version", [2 x i32] [i32 26, i32 0]}
!1 = !{i32 1, !"wchar_size", i32 4}
!2 = !{i32 8, !"PIC Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 1}
!4 = !{i32 7, !"frame-pointer", i32 1}
!5 = !{!"clang version 19.1.3 (git@github.com:zylc369/Arkari.git ef2500cb061e3b3f97cea27f8f8127a5478075b3)"}
